package com.example.wm.SanWar.controller;

import com.example.wm.common.Result;
import com.example.wm.common.ResultData;
import com.example.wm.SanWar.entity.AnnouncementTable;
import com.example.wm.SanWar.service.AnnouncementTableService;
import com.example.wm.utils.TsyUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping("/AnnouncementTableController")
public class AnnouncementTableController {
    @Resource
    private AnnouncementTableService announcementTableService;
    @Resource
    private TsyUtils tsyUtils;
    @Transactional
    @PostMapping("/Insert")
    public Result Insert(@RequestBody AnnouncementTable announcementTable) {
        announcementTable.setPublishtime(tsyUtils.getnowtime());
        boolean b=   announcementTableService.save(announcementTable);

        return ResultData.success(b);


    }
}
